<template>
    <div class="img">
        <!-- <el-image :src="imgUrl" @click="edit" style="width: 360px;height: 200px;border-radius: 10px;" v-if="imgUrl" /> -->
        <div style="padding-top:0px">
            
            <el-upload class="upload-demo" :action="$apiHost +'/img/fileImgUrl'" :headers="headers"
            :on-success="onSuccess" accept=".jpg,.png,.jpeg"
                >
                <el-button size="small" type="primary" >{{btnText}}</el-button>
            </el-upload>
           
        </div>
        <el-image v-for='(v,i) in imgUrl':src="v"  :preview-src-list="imgUrl"  :key="i" round="10" style="width: 50px;height:50px;margin-top: 10px;"></el-image>
        <div></div>
        <el-link @click="edit" v-if="imgUrl.length !=0 " type="danger">清空</el-link>
    </div>
</template>
<script>
export default {
    computed: {
        headers() {
            return {
                token: this.tokenv3 || window.$quinn.getStorage("tokenv3")
            };
        },
    },
    props:{
        btnText:{
            type:String,
            default:'上传回款凭证'
        }
    },
    data() {
        return {
            imgUrl: [],
            sendImg:[]
        }
    },
    methods: {
        edit() {
            this.imgUrl = []
            this.sendImg =[]
            this.$emit('clearList','clear');
        },
        onSuccess(e) {
            this.imgUrl.push('https://'+e.result[0]);
            this.sendImg.push(e.result[0])
            this.$emit('url', this.sendImg);
        }
    }
}
</script>
<style lang="less" scoped>

.img /deep/ .el-upload-list {
    display: none;
}
 
</style>